package com.feng.cloud.system.controller;

import com.feng.cloud.common.response.RestResponse;
import com.feng.cloud.common.response.TableResultResponse;
import com.feng.cloud.system.entity.Role;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.Map;

/**
 * @ClassName IRoleController
 * @Description TODO
 * @Author Better Feng
 * @Date 2019/12/26 11:30
 * @Version 1.0
 **/
@RequestMapping("role")
public interface IRoleController {

    /**
     * 删除角色
     * @param roleIds roleIds
     * @return RestResponse<Void>
     */
    @DeleteMapping("/{roleIds}")
    RestResponse<Void> deleteRoles(@NotBlank(message = "{required}") @PathVariable String roleIds);

    /**
     *  更新角色
     * @param role Role
     * @return RestResponse<Role>
     */
    @PutMapping
    RestResponse<Role> updateRoleById(@Valid Role role);
    /**
     * 新增角色
     * @param role Role
     * @return RestResponse<Role>
     */
    @PostMapping
    RestResponse<Role> add(@Valid Role role);
    /**
     * 根据角色名查询角色
     * @param roleName roleName
     * @return RestResponse<Role>
     */
    @GetMapping("check/{roleName}")
    RestResponse<Role> selectRoleByName(@NotBlank(message = "{required}") @PathVariable String roleName);
    /**
     * 列表查询
     * @param params Map
     * @return TableResultResponse
     */
    @GetMapping("page")
    TableResultResponse<Role> selectPage(@RequestParam Map<String, Object> params);

    /**
     * 查询列表
     * @return RestResponse<List < Role>>
     */
    @GetMapping("list")
    RestResponse<List<Role>> selectList();
}
